{include file="public/header" select="0" /}
<body>
<div class="title bgc">
    <i class="layui-icon layui-icon-left" onclick="goBack()"></i>
    提交订单
</div>

<div class="submit-address">
    <img src="/static/index/img/circel.png" alt="">
    {if !$temporary.address}
    <div class="submit-address-news add_address">
        <i class="layui-icon layui-icon-add-circle-fine"></i>添加收货地址
    </div>
    {else}
    <div class="submit-address-news submit-address-left choice_address">
        <p><a class="name">{$temporary.address.nickname}</a> {$temporary.address.tel}
            {if $temporary.address.default == 1}<span class="default">默认</span>{/if}
        </p>
        <p>{$temporary.address.p.title}
            {$temporary.address.c.title}
            {$temporary.address.d.title}
            {$temporary.address.t.title}
            {$temporary.address.details}</p>
    </div>
    {/if}
</div>

<div class="index-join bgc submit-mgt">
    <div class="index-join-title">订单详情</div>
    <ul class="index-join-container">
        {foreach name="temporary.products" item="vo" }
        <li>
            <a>
                <img src="{$vo.icon}" alt=""/>
                <div class="index-join-rgt">
                    <p>{$vo.title}</p>
                    <div>
                        <p>￥{$vo.price}</p>
                        <p>x{$vo.num}</p>
                    </div>
                </div>
            </a>
        </li>
        {/foreach}
    </ul>
</div>
<div class="submit-btm bgc">
    <p>合计：<span>￥{$temporary.total}</span></p>
    <p><a href="javascript:;" class="submitOrder">提交订单</a></p>
</div>
</body>
{include file="public/footer" select="0" /}
<script>
    $('.submitOrder').click(function () {
        var address_id = '{$temporary.address?$temporary.address.id:""}';
        if (!address_id) {
            layer.msg('请选择收货地址');
            return false;
        }
        _ajax("{:url('order/submit')}", {address_id: address_id});
    });
    $('.add_address').click(function () {
        location.href = "{:url('address/add')}?type=add";
    });
    $('.choice_address').click(function () {
        layer.open({
            type: 2,
            anim: 2,
            offset: 'b',
            title: '请选择收货地址',
            shadeClose: true,
            shade: 0.8,
            area: ['380px', '50%'],
            content: '{:url(\'address/index\')}?type=choice' //iframe的url
        });
    });

</script>